package com.fjc.controller;

import com.fjc.base.ResponseObject;
import com.fjc.domain.AttendLog;
import com.fjc.domain.QueryModel;
import com.fjc.service.AttendService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by fjc on 2018/9/15.
 */
@RestController
@RequestMapping("/attend")
public class AttendController {

    @Autowired
    private AttendService attendService;

    @PostMapping("/sbdk")
    public ResponseObject sbdk(AttendLog attendLog){
        return attendService.sbdk(attendLog);
    }

    @PostMapping("/getDk")
    public ResponseObject getDk(QueryModel queryModel){
        System.out.println(queryModel);
        List<AttendLog> list = attendService.getDk(queryModel);
        PageInfo<AttendLog> pageInfo = new PageInfo<>(list);
        System.out.println(" ***********" + pageInfo);
        return new ResponseObject(00,"成功",pageInfo);
    }

    @PostMapping("/save")
    public ResponseObject save(AttendLog attendLog){
        System.out.println(attendLog);
        return attendService.save(attendLog);
    }

    @GetMapping("/del")
    public ResponseObject del(AttendLog attendLog){
        return attendService.del(attendLog);
    }
}

